//
//  YYT_PremiereShowView.m
//  AudioVisualFeast
//
//  Created by dllo on 16/1/27.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "YYT_PremiereShowView.h"
#import "YYT_BaseTableViewCell.h"
#import "YYT_ModleShared.h"

@interface YYT_PremiereShowView()<UITableViewDataSource, UITableViewDelegate>
@end

@implementation YYT_PremiereShowView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self kongjian];
    }
    return self;
}

- (void)kongjian{
    self.tableview = [[UITableView alloc] initWithFrame:CGRectMake(0, 44, WIDTH, HEIGHT - 64 - 44 - 49) style:UITableViewStylePlain];
    [_tableview registerClass:[YYT_BaseTableViewCell class] forCellReuseIdentifier:@"CellIdentifier"];
    _tableview.backgroundColor = [UIColor blackColor];
    _tableview.delegate = self;
    _tableview.dataSource = self;
    _tableview.separatorStyle = NO;
    [self addSubview:self.tableview];
    
}





-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.array.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    YYT_BaseTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CellIdentifier"];
//     不加保护 有时候cr
    if (self.array.count > 0) {
        if (indexPath.row < self.array.count) {
            cell.model = self.array[indexPath.row];
        }
    }
    return cell;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 145;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    //协议第三步
    [self.PremiereDelegate pushToPremiereDetailVCtableview:tableView didSelectIndexPath:indexPath];
}

@end
